<?php

error_reporting( E_ALL ^ E_NOTICE );

/* the application directory */
$application = "application";

/* the system directory. preferably beneath the document root or somewhere inaccessible through HTTP */
$system = "system";

/* for http paths (viewed-as-client paths) */
// rewriting?
if( strpos($_SERVER['REQUEST_URI'], basename(__FILE__) ) === false ) {
	define('INDEX_FILE', '' );
	define('BASE_URL', 'http://' . $_SERVER['SERVER_NAME' ] . dirname( $_SERVER['SCRIPT_NAME'] ) .'' );
}

// guess not.
else {
	define('INDEX_FILE', basename(__FILE__) );
	define('BASE_URL', 'http://' . $_SERVER['SERVER_NAME' ] . dirname( $_SERVER['SCRIPT_NAME'] ) .'/' );
}

/* for internal sytem paths (viewed-from-server paths) */
define('APP_PATH', realpath( $application) );
define('SYSTEM_PATH', realpath( $system ) );

require(SYSTEM_PATH . '/autoload.php');

$router = new Router();
$router->route();